package com.cctc.mychat.client.command.impl;

import com.cctc.mychat.client.command.Command;
import com.cctc.mychat.common.protocol.message.impl.request.LogoutRequestMessage;
import io.netty.channel.Channel;

import java.util.Scanner;

public class LogoutCommand extends AbstractCommand {
    @Override
    public void run(Scanner scanner, Channel channel) {
        System.out.println("--> 您确定要注销吗？（Y / N）");
        String in = scanner.next();
        if ("Y".equals(in)) {
            LogoutRequestMessage request = LogoutRequestMessage.builder().build();
            channel.writeAndFlush(request);
        } else if ("N".equals(in)) {
            System.out.println("--> 取消注销！！！");
        } else {
            System.out.println("--> 输入格式不正确！！！");
        }
    }
}
